#include "display.h"

void disp_x_center(int y, int str_len, uint16_t bc, unsigned char sizey, unsigned char *str)
{
    int str_center_x = (sizey * str_len) / 2;
    int str_center_y = sizey / 2;

    LCD_ArcRect(screen_center_x - str_center_x - 10, y, screen_center_x + str_center_x + 10, sizey + y, bc);
    LCD_ShowChinese(screen_center_x - str_center_x, y, str, WHITE, bc, sizey, 1);
}

void disp_string_rect(int x, int w, int y, int h, int str_len, int sizey, unsigned char *str, int color)
{
    int str_center_x = (sizey * str_len) / 2;
    int rect_center_x = x + (w / 2);
    int str_center_y = sizey / 2;
    int rect_center_y = y + (h / 2);

    LCD_ArcRect(x, y, x + w, y + h, color);
    LCD_ShowChinese(rect_center_x - str_center_x, rect_center_y - str_center_y, str, WHITE, color, sizey, 1);
}

void disp_select_box(int x, int w, int y, int h, int line_length, int interval, int color)
{
    x = x - interval;
    w = w + (interval + interval);
    y = y - interval;
    h = h + (interval + interval);
    
    LCD_DrawLine(x, y, x + line_length, y, color);
    LCD_DrawLine(x, y, x, y + line_length, color);
    LCD_DrawLine(x + w, y, x + w - line_length, y, color);
    LCD_DrawLine(x + w, y, x + w, y + line_length, color);
    LCD_DrawLine(x, y + h, x + line_length, y + h, color);
    LCD_DrawLine(x, y + h, x, y + h - line_length, color);
    LCD_DrawLine(x + w, y + h, x + w - line_length, y + h, color);
    LCD_DrawLine(x + w, y + h, x + w, y + h - line_length, color);
}